package sort;

public class InsertionSort {
	public static long Sort(int[] list){
		long startTime = System.currentTimeMillis();
			
		for(int i=1, j=i; i < list.length; i++, j=i){
			while(j>0 && list[i]<list[j-1]) j--;;
			
			SortTest.shiftAndInsert(list, i, j);
		}
		return System.currentTimeMillis()-startTime;
	}
	
	public static int[] SortList(int[] list){
		for(int i=1, j=i; i < list.length; i++, j=i){
			while(j>0 && list[i]<list[j-1]) j--;;
			
			SortTest.shiftAndInsert(list, i, j);
		}
		return list;
	}
	
	public static void particialSort(int[] list, int from, int to) {
		for(int i=from, j=i; i < to; i++, j=i){
			while(j>0 && list[i]<list[j-1]) j--;;
			
			SortTest.shiftAndInsert(list, i, j);
		}
	}
}